package com.woniu.outlet.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Component
@FeignClient(value = "finance-reliable-message")
public interface OrderMessage {

    /**
     * 发送消息到消息队列的方法
     * @param exchange
     * @param routingKey
     * @param messageContent
     * @return
     */
    @PostMapping("/message/send")
    public boolean sendMessage(
            @RequestParam("exchange") String exchange,
            @RequestParam("routing_key") String routingKey,
            @RequestParam("message_content") String messageContent);

    /**
     * 确定消息已经被消费
     * @param messageId
     * @return
     */
    @PostMapping("/message/{id}/received")
    public boolean receivedMessage(@PathVariable("id") Integer messageId);

}
